<?php
/**
 * Terrafirma :: Extensive pattern & component framework
 * Copyright 2010-2011 Ian Unruh (Xerof3ar)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Terrafirma\Event\Hub\Repository;

use ArrayIterator;
use ArrayObject;
use Terrafirma\Event\EventInterface;
use Terrafirma\Event\Hub\RepositoryInterface;

/**
 * <b>Null Object pattern</b> implementation of RepositoryInterface
 * 
 * @author Ian Unruh (Xerof3ar) <ianunruh@gmail.com>
 * @since Class avaliable since version 1.0
 */
class EmptyRepository implements RepositoryInterface
{
	/**
	 * Clears all subscribers from this repository
	 * @return void
	 */
	public function clear()
	{
	}
	
	/**
	 * Returns the number of subscribers stored in this repository
	 * @return int
	 */
	public function count()
	{
		return 0;
	}
	
	/**
	 * Returns all subscribers stored in this repository
	 * @return ArrayObject<SubscriberInterface>
	 */
	public function getAll()
	{
		return new ArrayObject();
	}
	
	/**
	 * Returns all subscribers that should be notified of a given event
	 * 
	 * @param EventInterface $event
	 * @return ArrayObject<SubscriberInterface>
	 */
	public function getAllByEvent(EventInterface $event)
	{
		return new ArrayObject();
	}
	
	/**
	 * Returns an iterator that is used to iterate over subscribers
	 * @return Iterator<SubscriberInterface>
	 */
	public function getIterator()
	{
		return new ArrayIterator(array());
	}
}